using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Criterion;

using QLTDK.Entities;
using QLTDK.DataAccess.Interfaces.BaseInterfaces;
using QLTDK.DataAccess.Base;

namespace QLTDK.DataAccess.BaseDaos
{
    public class BaseCtrDuytuDao : NHibernateDao<CtrDuytu, int>, IBaseCtrDuytuDao
    {
		#region Constructors
		
		public BaseCtrDuytuDao() : base()
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<CtrDuytu> GetByMaCongTrinh(System.Int32 maCongTrinh)
        {
			return HibernateTemplate.ExecuteFind<CtrDuytu>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(CtrDuytu));
					
					
					ICriteria maCongTrinhCriteria = criteria.CreateCriteria("MaCongTrinh");
					maCongTrinhCriteria.Add(Expression.Eq("Id", maCongTrinh));
					
					return criteria.List<CtrDuytu>();
				});
        }
		
		#endregion
    }
}